use lazy_static::lazy_static;
use std::collections::HashMap;

lazy_static! {
    pub static ref STRINGS: HashMap<&'static str, HashMap<&'static str, &'static str>> = {
        let mut map = HashMap::new();
        
        // 中文
        let mut zh = HashMap::new();
        zh.insert("press_any_key", "按任意键开始");
        zh.insert("game_title", "Geb 引擎");
        zh.insert("quit_hint", "按 Q 退出");
        zh.insert("player_health", "生命值");
        zh.insert("fps", "帧率");
        map.insert("zh", zh);
        
        // 英文
        let mut en = HashMap::new();
        en.insert("press_any_key", "Press any key to start");
        en.insert("game_title", "Geb Engine");
        en.insert("quit_hint", "Press Q to quit");
        en.insert("player_health", "Health");
        en.insert("fps", "FPS");
        map.insert("en", en);
        
        map
    };
}

pub fn get_string(key: &str, lang: &str) -> &'static str {
    STRINGS.get(lang)
        .and_then(|lang_map| lang_map.get(key))
        .or_else(|| STRINGS.get("en").and_then(|m| m.get(key)))
        .unwrap_or(&"")
}